package com.mashibing.juc.c_001;

/**
 * @ClassName T02_Synchronized
 * @Description synchronized关键字，对某个线程加锁
 * @Author xiongwei.wu
 * @Date 2021/6/30 16:38
 **/
public class T02_Synchronized {
    private int count = 10;

    public void m() {
        //任何线程执行这段代码，必须先拿到this的锁
        synchronized (this) {
            count--;
            System.out.println(Thread.currentThread().getName() + " count = " + count);
        }
    }
}
